import request from '@/utils/request'

const api_name = '/library/user'

export default {
    //根据id查询用户
    selectUserById(id) {
        return request({
            url: `${api_name}/selectUserById/${id}`,
            method: 'get'
        })
    },
    //查询所有用户
    selectAllUsers() {
        return request({
            url: `${api_name}/selectAllUsers`,
            method: 'get'
        })
    },
    //条件查询用户，带分页
    selectUsersByConditionPage(page, limit, searchObj) {
        return request({
            url: `${api_name}/selectUsersByConditionPage/${page}/${limit}`,
            method: 'post',
            data: searchObj
        })
    },
    //新增用户
    insertUser(user) {
        return request({
            url: `${api_name}/insertUser`,
            method: 'post',
            data: user
        })
    },
    //根据id修改用户
    modifyUser(user) {
        return request({
            url: `${api_name}/modifyUser`,
            method: 'put',
            data: user
        })
    },
    //根据id逻辑删除用户
    removeUserById(id) {
        return request({
            url: `${api_name}/removeUserById/${id}`,
            method: 'delete'
        })
    },
    //批量删除用户
    removeBatchByIds(ids) {
        return request({
            url: `${api_name}/removeBatchByIds`,
            method: 'delete',
            data: ids
        })
    }
}